﻿@model IEnumerable<HdipCricketClub.Models.Club>

@{
    ViewBag.Title = "Index";
}

<h2>Clubs:</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            Name:
        </th>
        <th>
            Address:
        </th>
        <th>
            Phone:
        </th>
        <th>
            E Mail
        </th>
        <th>
            President:
        </th>
        <th>
            Chairman:
        </th>
        <th>
            Secretary:
        </th>
        <th>
            Fixtures Secretary:
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.address_1),
            @if(item.address_2 != null)
            {
               @Html.DisplayFor(modelItem => item.address_2)@:, 
            }                                             
            @Html.DisplayFor(modelItem => item.town_city),
            @Html.DisplayFor(modelItem => item.County1.name),
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.phone)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.email)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Member.first_name) @Html.DisplayFor(modelItem => item.Member.last_name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Member1.first_name) @Html.DisplayFor(modelItem => item.Member1.last_name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Member2.first_name) @Html.DisplayFor(modelItem => item.Member2.last_name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Member3.first_name) @Html.DisplayFor(modelItem => item.Member3.last_name)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.club_id }) |
            @Html.ActionLink("Details", "Details", new { id = item.club_id }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.club_id })
        </td>
    </tr>
}

</table>
